## 模板1
import os

env = None
Enable_Clang = False
# 1.编译器
if Enable_Clang and os.system("which clang") == 0:
    # clang编译器
    env = Environment(tools=["default", "clang"])
    env["CC"] = ["clang"]
    env["CXX"] = ["clang++"]
else:
    env = Environment()

env["PROGSUFFIX"] = ".out"              # 可执行文件后缀.out
env["CCFLAGS"] = " -g3 -O0 -Wall"       # gdb 调试

sources=0
ccflags=1
linkflags=2
target_list = [
    "1_make_unique智能指针.cc",
    "11_unique_ptr_独占指针.cc",
    # "14_unique_ptr_独占智能指针_多个ptr指向同一对象-ng.cc",   # 编译错误
    "15_make_shared_智能指针.cc",
    "15.1_make_shared_共享智能指针_生命周期测试.cc",
    "21_shared_ptr_共享智能指针.cc",
    ["21.1_shared_ptr_共享智能指针_后初始化.cc","",""],
    ["21.2_shared_ptr_共享智能指针_通过参数赋值智能指针.cc","",""],
    "22_shared_ptr_通过make_shared创建.cc",
    "31_weak_ptr_弱引用指针.cc",
]
for target in target_list:
    if isinstance(target,(str)):
        env.Program(Split(target))
    elif isinstance(target,(list)):
        env.Program(Split(target[sources]),CCFLAGS=target[ccflags]+env["CCFLAGS"],LINKFLAGS=target[linkflags]+env["LINKFLAGS"])
